home *** CD-ROM | disk | FTP | other *** search
- INPUT.TPU
- The Screen Input Unit for Turbo Pascal
- by David C. Swaim II
-
-
- INPUT.TPU is a Turbo Pascal Unit designed for data input using
- screen input fields with user (programmer) defined locations and
- widths. The unit consists of three Pascal procedures which can be used
- independently. The first two are very simple procedures for turning
- the cursor on and off. CursorOn turns the cursor on and CursorOff
- turns it off. These procedures have no parameters passed to them so
- they are called by:
-
- CursorOn;
-
- or
-
- CursorOff;
-
- The main routine in this unit is called GetIn. This routine is
- defined by:
-
- Procedure GetIn( Numin: Boolean;
- Maxin,x,y: Integer;
- var Indata: InputString;
- var Insrt: Boolean;
- var Control: Char;
- var Number: Real);
-
- Where:
- Numin = True means the field is for numeric data input,
- False means text string input.
-
- Maxin = The character width of the input field. This
- is the maximum number of characters that can be
- typed into the input field. When this maximum
- is reached the input is terminated just like it
- is when the Enter key is pressed.
-
- x,y = The x and y location on the screen of the input
- field. This is the same as used in the GotoXY
- procedure.
-
- Indata = This is the input data string. You may load
- this string with data before calling the
- procedure. This allows having a default input
- placed in the field. The input string will be
- returned in Indata. Indata is declared as data
- type InputString:
-
- type
- InputString = String[255];
-
- This type is declared in the interface section
- of the unit and does not need to be declared in
- your program.
-
- Insrt = True means that anything typed will be inserted
- in the input data string at the cursor
- location. False means anything typed will
- replace whatever is already in the input
- string at the cursor location. Insrt may be
- set to True or False before calling GetIn or
- it can be toggled on and off by hitting the
- Ins key while inputting.
-
- Control = This is a control character returned by GetIn
- if a control key is pressed while GetIn is
- executing. The following function keys are
- defined global in the input unit:
-
- NULL = #00; CsrDn = #80;
- Beep = #07; CsrRt = #77;
- PgUp = #73; CsrLt = #75;
- PgDn = #81; Home = #71;
- CsrUp = #72; Esc = #27;
- CarriageReturn = #13;
- F1 = #59; F2 = #60; F3 = #61; F4 = #62;
- F5 = #63; F6 = #64; F7 = #65; F8 = #66;
- F9 = #67; F10 = #68;
-
- Thus whether the F1 key has been pressed may be
- checked by simply saying "if Control = F1 then
- . . . ."
-
- Number = The numeric representation of Indata if Numin
- is True.
-
-
- There is one other global variable that may be of interest. That
- is the variable CsrLocation. This variable is the location of the
- cursor within the input field (0 to Maxin). If you want the cursor to
- start at the first character of the input field then set CsrLocation to
- zero:
-
- CsrLocation := 0;
-
- The GetIn procedure is set up so it will halt the program if the
- Ctrl and End keys are pressed together. Use this key combination with
- care since GetIn does not clean up any open files before halting the
- program.
-
-